import type { TableColumnCtx } from 'element-plus'
import { dayjs } from 'element-plus';
import store from '@/store';
interface LostGooddsListItem {
  goodsType: string
  goodsName: string
  lostTimeStart: string
  lostTerminal: string
  lostPlace: string
  timeLimit: string
  goodsLimitTime: string
  loseName: string
  losePhone: string
  createTime: string
  img: string
  state: number
}
export const loseGoodsColumns = [
  {
    type: 'index',
    label: '序号',
    width: 60,
    align: 'center'
  },
  {
    prop: 'goodsType',
    label: '物品类型',
    minWidth: 130,
    align: 'center',
    formatter: function (row:LostGooddsListItem, column:TableColumnCtx<LostGooddsListItem>, cellValue:string) {
      return store.getters['goodsType/getGoodsTypeName'](cellValue)
    }
  },
  { prop: 'goodsName', label: '物品名称', minWidth: 200, align: 'center' },
  {
    prop: 'lostTime',
    label: '遗失时间',
    sortable: true,
    minWidth: 250,
    align: 'center'
    // formatter: function (row:LostGooddsListItem, column:TableColumnCtx<LostGooddsListItem>, cellValue:string) {
    //   return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss')
    // }
  },
  { prop: 'lostTerminal', label: '航站楼', minWidth: 120, align: 'center' },
  { prop: 'lostPlace', label: '遗失地', minWidth: 120, align: 'center' },
  { prop: 'timeLimit', label: '保质期', minWidth: 120, align: 'center' },
  {
    prop: 'goodsLimitTime',
    label: '保存时限',
    sortable: true,
    minWidth: 180,
    align: 'center',
    formatter: function (row:LostGooddsListItem, column:TableColumnCtx<LostGooddsListItem>, cellValue:string) {
      return cellValue ? dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss') : '-'
    }
  },
  { prop: 'lostName', label: '失主姓名', minWidth: 120, sortable: true, align: 'center' },
  { prop: 'lostPhone', label: '失主电话', minWidth: 120, align: 'center' },
  {
    prop: 'create_time',
    label: '登记时间',
    sortable: 'custom',
    minWidth: 180,
    align: 'center',
    formatter: function (row:LostGooddsListItem, column:TableColumnCtx<LostGooddsListItem>, cellValue:string) {
      return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss')
    }
  },
  { prop: 'createName', label: '登记人', minWidth: 120, align: 'center' },
  {
    prop: 'img',
    label: '图片',
    minWidth: 120,
    align: 'center'
  },
  {
    prop: 'status',
    label: '状态',
    fixed: 'right',
    minWidth: 80,
    align: 'center'
  },
  { prop: 'action', label: '操作', fixed: 'right', minWidth: 180, align: 'center' }
]
